package com.yeyks.activity.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeyks.activity.dal.domain.ActivityUserJoinRecord;
import com.yeyks.activity.dal.dao.ActivityUserJoinRecordMapper;
import com.yeyks.activity.service.ActivityUserJoinRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeyks.common.dto.DoubleDanConfig;
import org.springframework.stereotype.Service;


/**
 * <p>
 * 活动参加用户记录表 服务实现类
 * </p>
 *
 * @author shuai
 * @since 2019-11-28
 */
@Service
public class ActivityUserJoinRecordServiceImpl extends ServiceImpl<ActivityUserJoinRecordMapper, ActivityUserJoinRecord> implements ActivityUserJoinRecordService {

    /**
     * 抽奖人数
     *
     * @param activityCode
     * @return
     */
    @Override
    public Integer lotteryUserCount(String activityCode) {
        Integer count = baseMapper.selectCount(new QueryWrapper<ActivityUserJoinRecord>()
                .eq(ActivityUserJoinRecord.ACTIVITY_CODE, activityCode));
        return null == count ? 0 : count;
    }

    /**
     * 活动下单人数
     *
     * @param doubleDanConfig
     * @return
     */
    @Override
    public Integer orderCount(DoubleDanConfig doubleDanConfig) {
        Integer count = baseMapper.orderCount(doubleDanConfig);
        return null == count ? 0 : count;
    }
}
